<template>
  <Card style="width: 100%;" title="用户管理">
    <Form name="user" ref="form" :labelCol="labelCol" :wrapperCol="wrapperCol">
      <Row>
        <Col :span="8">
          <FormItem name="resourceName" label="用户名称">
            <Input placeholder="请输入用户名称" style="width: 100%" />
          </FormItem>
        </Col>
        <Col :span="8">
          <FormItem name="resourceType" label="用户状态">
            <Select placeholder="角色状态" style="width: 100%">
              <Option label="正常" value="正常" />
              <Option label="禁用" value="禁用" />
            </Select>
          </FormItem>
        </Col>
        <Col :span="8">
          <FormItem name="resourcePhone" label="手机号">
            <Input placeholder="请输入手机号" style="width: 100%" />
          </FormItem>
        </Col>
      </Row>
      <Row>
        <Col :span="5" :offset="19">
          <Button type="primary" style="margin-right: 10px" size="md"
            >查询</Button
          >
          <Button type="primary" style="margin-right: 10px" size="md"
            >重置</Button
          >
          <a href="#" style="color: #b30000">更多 <Icon name="down" style="vertical-align: middle" /></a>
        </Col>
      </Row>
    </Form>
    <div style="width: 100%;height: 2px; background-color: #E9EBF0;margin: 20px 0"></div>
    <Button type="primary" style="margin-right: 10px;margin-bottom: 20px;" size="md"
            ><Icon name="add"/> 新增</Button
          >
    <Table
      :columns="columns3"
      :dataSource="data"
      :bordered="false"
      @change="handleTableChange"
      :pagination="{
        total: data.length,
        showQuickJumper: true,
        showSizeChanger: true,
        pageSize,
        current,
      }"
    >
      <template #render="render">
        <div v-if="render.dataIndex == 'status'">
           <Switcher type="text" />
        </div>
        <div v-else-if="render.dataIndex == 'operation'">
          <a href="#" @click="handClick('123')">编辑</a>
          <span>|</span>
          <a href="#" @click="deleteClick('123')">删除</a>
        </div>
      </template>
      <template #paginationTotal="props">
        <span>总共{{ props.total }} 条</span>
      </template>
    </Table>
  </Card>
</template>

<script>
export default {
  data() {
    return {
      labelCol: {
        span: 8,
      },
      wrapperCol: {
        span: 12,
      },
      data: [
       {
          id: "3",
          name: "admin",
          role: "超级管理员",
          phone: "15612341345",
          createTime: "2017-10-31 12:13:00",
        },
         {
          id: "2",
          name: "admin",
          role: "超级管理员",
          phone: "15612341345",
          createTime: "2017-10-31 12:13:00",
        },
        {
          id: "3",
          name: "admin",
          role: "超级管理员",
          phone: "15612341345",
          createTime: "2017-10-31 12:13:00",
        },
      ],
      columns3: [
        { title: "序号", dataIndex: "id", key: "id" },
        { title: "用户名称", dataIndex: "name", key: "name" },
        { title: "角色", dataIndex: "role", key: "role" },
        {
          title: "手机号码",
          dataIndex: "phone",
          key: "phone",
        },
     
        { title: "状态", dataIndex: "status", key: "status" },
        { title: "创建时间", dataIndex: "createTime", key: "createTime" },
        { title: "操作", dataIndex: "operation", key: "operation" },
      ],
      current: 1,
      pageSize: 5,
    };
  },
  methods: {
    handleTableChange(p, filters) {
      const { current, pageSize } = p;
      this.current = current;
      this.pageSize = pageSize;
      console.log("===>>>>filters", p, filters);
    },
    onSearch(value, e) {
      console.log("value", value, e);
    },
    handClick(){},
    deleteClick(){},
  },
};
</script>


